#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#  Copyright (c) Huoty - All rights reserved
# 
#      Author: Huoty <sudohuoty@gmail.com>
#  CreateTime: 2016-10-26 11:14:33
# *************************************************************

def wrap(func):
    def call_it(*args, **kwargs):
        print "calling", func.__name__
        return func(*args, **kwargs)
    return call_it

@wrap
def hello():
    print "hello"

from functools import update_wrapper
def wrap2(func):
    def call_it(*args, **kwargs):
        print "calling", func.__name__
        return func(*args, **kwargs)
    return update_wrapper(call_it, func)

@wrap2
def hello2():
    print "hello2"

from functools import wraps
def wrap3(func):
    @wraps(func)
    def call_it(*args, **kwargs):
        print "calling", func.__name__
        return func(*args, **kwargs)
    return call_it

@wrap3
def hello3(func):
    print "hello3"


# Script starts from here

if __name__ == '__main__':
    print hello.__name__
    print hello2.__name__
    print hello3.__name__
